In an image forming apparatus including a scanner or the like that can read an image of a document sheet, the size of a document sheet placed on a document sheet placement surface is detected before an image reading process is executed in some cases. For example, a technology of detecting the size of both whitish and blackish document sheets by emitting light from a reading unit immediately before or after a document sheet cover is closed by a user to read image data, and identifying the edge of a document sheet based on the read image data is known (e.g., see Patent Literature 1).